package fr.znight.chacunsatv.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;

public class BackgroundService extends Service {

   @Override
   public IBinder onBind(Intent intent) {
      return null;
   }

   @Override
   public void onCreate() {
	   
       Log.d("", "Le Service starts");

		Thread thread = new Thread()
		{
		    @Override
		    public void run() {
		        try {
		            while(true) {
		                sleep(1000);
		                
		                Log.d("", "Le Service est en train de foncctioner");
		                
		       		 ChatServer server=new ChatServer(BackgroundService.this);

		            }
		        } catch (InterruptedException e) {
		            e.printStackTrace();
		        }
		    }
		};

		thread.start();   }

   @Override
   public void onDestroy() {
      //code to execute when the service is shutting down
   }

   @Override
   public int onStartCommand(Intent intent, int flags, int startid) {
      return Service.START_STICKY;
   }
}